package judge.mq;

import api.domain.dto.JudgeSubmitDTO;
import judge.service.IJudgeService;
import lombok.extern.slf4j.Slf4j;
import mq.RabbitMqConstant;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class JudgeConsumer {
    @Autowired
    private IJudgeService judgeService;
    @RabbitListener(queues = RabbitMqConstant.OJ_WORK_QUEUE)
    public void consume(JudgeSubmitDTO judgeSubmitDTO) {
        log.info("JudgeConsumer receive: {}", judgeSubmitDTO);
        judgeService.doJudgeJavaCode(judgeSubmitDTO);
    }
}
